import { fileURLToPath, URL } from 'node:url';

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
import { AcceptedPlugin } from 'postcss';
const tailwindcss: AcceptedPlugin = require('tailwindcss');
const autoprefixer: AcceptedPlugin = require('autoprefixer');
export default defineConfig({
	plugins: [
		vue(),
		vueJsx(),
		AutoImport({
			imports: ['vue', 'vue-router', 'pinia']
		}),
		Components({
			resolvers: [NaiveUiResolver()]
		})
	],
	resolve: {
		alias: {
			'@': fileURLToPath(new URL('./src', import.meta.url))
		}
	},
	server: {
		open: true
	},
	css: {
		postcss: {
			plugins: [tailwindcss, autoprefixer]
		}
	}
});
